<template>
	<!--  -->
	<view class="wp">
<!-- 		<view class="list_item">
			<text>合伙人：</text>
			<uni-data-checkbox v-model="info.bonuslevel" :localdata="local"></uni-data-checkbox>
			<uni-easyinput type="text" :clearable="false" v-model="info.partnerBonus" v-if="info.bonuslevel==1" placeholder="合伙人分佣比例" />
		</view>
		<view class="message"  v-if="info.bonuslevel==1" >
			合伙人分佣比例区间为0.00—0.60（0%-60%）
		</view> -->
		<view class="list_item" v-if="info.isshow==1">
			<text>业务经理：</text>
			<uni-data-checkbox v-model="info.issaler" :localdata="local"></uni-data-checkbox>
		</view>
		<view class="message"  v-if="info.bonuslevel==1" >
			授权成功后，成为业务经理。
		</view>
		<button class="sub_but" @click="submitTap">提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mid: '',
				info: {
					bonuslevel: "0",
					issaler: "0",
					isshow: 0,
					partnerBonus:"0"
				},
				local: [{
					text: '否',
					value: '0'
				}, {
					text: '是',
					value: '1'
				}]
			}
		},
		onLoad(option) {
			this.mid = option.mid;
			this.getInfo();
		},
		methods: {
			getInfo() {
				this.$axios('customer/getPower', 'POST', 'member', {
					mid: this.mid
				}).then(res => {
					if (res.data.code == 200) {
						this.info = res.data.data;
					}
				})
			},
			submitTap() {
				if (this.info.partnerBonus >= 0.00 && this.info.partnerBonus <= 0.6 ) {
					
				this.$axios('customer/setPower', 'POST', 'member', {
					mid: this.mid,
					bonuslevel: this.info.bonuslevel,
					issaler: this.info.issaler,
					partnerBonus:this.info.partnerBonus,
				}).then(res => {
					if (res.data.code == 200) {
						this.$api.msg('提交成功！');
						setTimeout(() => {
							this.$navBack();
						}, 700)
					}
				})
				} else {
					this.$api.msg('请正确填写正确分佣比例！');
				}
			},
			// submitTap() {
				
			// 	this.$axios('customer/setPower', 'POST', 'member', {
			// 		mid: this.mid,
			// 		bonuslevel: this.info.bonuslevel,
			// 		issaler: this.info.issaler,
			// 		partnerBonus:this.info.partnerBonus,
			// 	}).then(res => {
			// 		if (res.data.code == 200) {
			// 			this.$api.msg('提交成功！');
			// 			setTimeout(() => {
			// 				this.$navBack();
			// 			}, 700)
			// 		}
			// 	})
			// },
		}
	}
</script>

<style lang="scss">
	.wp {
		padding: 20upx;

		.list_item {
			padding-bottom: 20upx;

			text {
				font-size: 32upx;
				line-height: 60upx;
			}
		}

		.sub_but {
			background:$bg-color;
			color: #fff;
			font-size: 32upx;
			line-height: 90upx;
			margin-top: 30upx;
		}
	}
	.message {
		color: #777;
		padding-bottom: 22px;
	}
</style>